/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.ArrayList;

/**
 *
 * @author Cyril
 */
public class NoeudsCollection {
    
    private static ArrayList<Noeud> nodes;

    public NoeudsCollection() {
        NoeudsCollection.nodes = new ArrayList<Noeud>();
    }
    
    public Noeud addNoeud(String name, String xpath, int docId) {
        int nodeId = NoeudsCollection.nodes.size()+1;
        Noeud n = new Noeud(nodeId, name, xpath, docId);
        nodes.add(n);
        return n;
    }
    
    public static int getNbNoeuds() {
        return nodes.size();//nodes.size();
    }
    
    public Noeud getCurrentNode() {
        return nodes.get(nodes.size()-1);
    }
    
    public ArrayList<String> getListValues() {
        ArrayList<String> res = new ArrayList<String>();
        for (Noeud node : NoeudsCollection.nodes) {
            res.add(node.getValue());
        }
        return res;
    }
}
